import Vue from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ELEMENT from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

import PageTools from '@/components/PageTools' // 导入工具栏组件
Vue.component('PageTools', PageTools) // 全局注册自定义组件

import UploadExcel from '@/components/UploadExcel/index.vue' // 上传表格
Vue.component('UploadExcel', UploadExcel)

import uploadImg from '@/components/UploadImg/index.vue' // 上传头像组件
Vue.component('uploadImg', uploadImg)

import i18n from '@/lang' // 多语言

import Lang from '@/components/Lang/index.vue' // 切换多语言组件
Vue.component('lang', Lang)

import ScreenFull from '@/components/ScreenFull/index.vue' // 切换全屏组件
Vue.component('ScreenFull', ScreenFull)

import Directive from './directive' // 按钮权限
Vue.use(Directive)

import dayjs from 'dayjs'
// 在Vue的原型上挂载 dateFormat 方法
Vue.prototype.$dateFormat = function(dt) {
  return dayjs(dt).format('YYYY-MM-DD')
}

Vue.use(ELEMENT, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ELEMENT)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
